#include <cstdio>
#include <memory.h>

char s[ 101 ][ 101 ];
int a[ 101 ][ 101 ], n, x, y;
bool visit[ 101 ][ 101 ];

void init( )
{
    int i;
    for ( i = 0; i < n; i++ )
        scanf("%s", s[ i ]);
    memset( a, 0, sizeof( a ) );
    scanf("%d%d", &x, &y);
    memset( visit, 0, sizeof( visit ) );
}

void dfs( int x, int y )
{
    if ( x < 0 || x >= n || y < 0 || y >= n || visit[ x ][ y ] )
        return ;
    visit[ x ][ y ] = true;
    int i, j;
    for ( i = -1; i <= 1; i++ )
        for ( j = -1; j <= 1; j++ )
            if ( i + x >= 0 && i + x < n && j + y >= 0 && j + y < n )
                if ( s[ i + x ][ j + y ] == 'X' )
                    a[ x ][ y ]++;
    if ( !a[ x ][ y ] )
        for ( i = -1; i <= 1; i++ )
            for ( j = -1; j <= 1; j++ )
                if ( i + x >= 0 && i + x < n && j + y >= 0 && j + y < n )
                    if ( s[ i + x ][ j + y ] == 'O' )
                        dfs( x + i, y + j );
}

void print( )
{
    int i, j;
    for ( i = 0; i < n; i++ )
    {
        for ( j = 0; j < n; j++ )
            if ( visit[ i ][ j ] )
                printf("%d", a[ i ][ j ]);
            else
                printf(".");
        puts("");
    }
    puts("");
}

int main( )
{
    while ( scanf("%d", &n) != EOF )
    {
        init( );
        if ( s[ x ][ y ] == 'X' )
        {
            puts("it is a beiju!\n");
            continue;
        }
        dfs( x, y );
        print( );
    }
    return 0;
}
